package wenjian;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
public class Test2 {
    public static void main(String[] args) {
        try{
            FileWriter fileWriter = new FileWriter("output.txt");
            BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
            String content = "Hello, World!";
            bufferedWriter.write(content);
            bufferedWriter.flush();
            bufferedWriter.close();
            System.out.println("File written successfully.");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
